package IU;

import Controladores.CtrlAMBOperario;
import Controladores.CtrlEstadoLagar;
import Entidades.Producto;
import java.util.Collection;
import java.util.List;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import utiles.Validador;
import Controladores.CtrlLagar;
import Controladores.CtrlProducto;
import Entidades.Estadolagar;
import Entidades.Lagar;
import Entidades.Operario;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

/**
 *
 * @author  Noelia
 * 
 * 
 * 
 * 
 */
public class ABMLagar extends javax.swing.JFrame {

    private String nombre, fechaAlta, fechaBaja,operario;
    Producto producto;
    TablaPersonalizada tableModel;
    private List lista, listap;
    CtrlProducto controladorprod;
    CtrlEstadoLagar controladorestlag;
    CtrlLagar controladorlagar;
    CtrlAMBOperario ctrloperario;
    Validador validador;
     
  
    String fecha;
    private List listaproducto;
    private String nomproducto;
    Operario oper;
    Lagar lagares;
    Estadolagar estadolagar;
    private List listaLagares;
    private List<Estadolagar> listaEstadosLagares;
    private List listalag;
    private List listaestlag;
    private List listaproductos;
    private List lagarListaUbicacion;
    private Operario o;



    public ABMLagar(String op) {
        initComponents();
        String operario = op;
        jTextFieldUsuario2.setText(operario);
        jTextFieldOperario1.setText(operario);
       jTextFieldoperario.setText(operario);
        controladorlagar = new CtrlLagar();
        controladorestlag = new CtrlEstadoLagar();
        controladorprod= new CtrlProducto();
        ctrloperario = new CtrlAMBOperario();
       
       cargarComboProductos();
       cargarComboProductos1();
       cargarComboIdentificacion();
        try {
             o = ctrloperario.buscarOperarioApellido(operario);
        } catch (Exception ex) {
            Logger.getLogger(ABMLagar.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
        bindingGroup = new org.jdesktop.beansbinding.BindingGroup();

        GestorPesajeJpaPU2EntityManager = java.beans.Beans.isDesignTime() ? null : javax.persistence.Persistence.createEntityManagerFactory("GestorPesajeJpaPU2").createEntityManager();
        productoQuery = java.beans.Beans.isDesignTime() ? null : GestorPesajeJpaPU2EntityManager.createQuery("SELECT p FROM Producto p");
        productoList = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : productoQuery.getResultList();
        productoQuery1 = java.beans.Beans.isDesignTime() ? null : GestorPesajeJpaPU2EntityManager.createQuery("SELECT p FROM Producto p");
        productoList1 = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : productoQuery1.getResultList();
        productoQuery2 = java.beans.Beans.isDesignTime() ? null : GestorPesajeJpaPU2EntityManager.createQuery("SELECT p FROM Producto p");
        productoList2 = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : productoQuery2.getResultList();
        productoQuery3 = java.beans.Beans.isDesignTime() ? null : GestorPesajeJpaPU2EntityManager.createQuery("SELECT p FROM Producto p");
        productoList3 = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : productoQuery3.getResultList();
        lagarQuery = java.beans.Beans.isDesignTime() ? null : GestorPesajeJpaPU2EntityManager.createQuery("SELECT l FROM Lagar l");
        lagarList = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : lagarQuery.getResultList();
        estadolagarQuery = java.beans.Beans.isDesignTime() ? null : GestorPesajeJpaPU2EntityManager.createQuery("SELECT e FROM Estadolagar e");
        estadolagarList = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : estadolagarQuery.getResultList();
        estadolagarQuery1 = java.beans.Beans.isDesignTime() ? null : GestorPesajeJpaPU2EntityManager.createQuery("SELECT e FROM Estadolagar e");
        estadolagarList1 = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : estadolagarQuery1.getResultList();
        estadolagarQuery2 = java.beans.Beans.isDesignTime() ? null : GestorPesajeJpaPU2EntityManager.createQuery("SELECT e FROM Estadolagar e");
        estadolagarList2 = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : estadolagarQuery2.getResultList();
        lagarQuery1 = java.beans.Beans.isDesignTime() ? null : GestorPesajeJpaPU2EntityManager.createQuery("SELECT l FROM Lagar l");
        lagarList1 = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : lagarQuery1.getResultList();
        lagarQuery2 = java.beans.Beans.isDesignTime() ? null : GestorPesajeJpaPU2EntityManager.createQuery("SELECT l FROM Lagar l");
        lagarList2 = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : lagarQuery2.getResultList();
        productoQuery4 = java.beans.Beans.isDesignTime() ? null : GestorPesajeJpaPU2EntityManager.createQuery("SELECT p FROM Producto p");
        productoList4 = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : productoQuery4.getResultList();
        productoQuery5 = java.beans.Beans.isDesignTime() ? null : GestorPesajeJpaPU2EntityManager.createQuery("SELECT p FROM Producto p");
        productoList5 = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : productoQuery5.getResultList();
        productoQuery6 = java.beans.Beans.isDesignTime() ? null : GestorPesajeJpaPU2EntityManager.createQuery("SELECT p FROM Producto p");
        productoList6 = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : productoQuery6.getResultList();
        productoQuery7 = java.beans.Beans.isDesignTime() ? null : GestorPesajeJpaPU2EntityManager.createQuery("SELECT p FROM Producto p");
        productoList7 = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : productoQuery7.getResultList();
        lagarQuery3 = java.beans.Beans.isDesignTime() ? null : GestorPesajeJpaPU2EntityManager.createQuery("SELECT l FROM Lagar l");
        lagarList3 = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : lagarQuery3.getResultList();
        lagarQuery4 = java.beans.Beans.isDesignTime() ? null : GestorPesajeJpaPU2EntityManager.createQuery("SELECT l FROM Lagar l");
        lagarList4 = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : lagarQuery4.getResultList();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel1 = new javax.swing.JPanel();
        jButtonGuardar = new javax.swing.JButton();
        jLabel4 = new javax.swing.JLabel();
        jTextFieldIdentificacion = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        jComboBoxUbicacion = new javax.swing.JComboBox();
        jLabel18 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jDateChooserSelectorFecha = new com.toedter.calendar.JDateChooser();
        jComboBoxEstado = new javax.swing.JComboBox();
        jComboBoxProducto = new javax.swing.JComboBox();
        jPanel2 = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        jScrollPane3 = new javax.swing.JScrollPane();
        jTableLagares = new javax.swing.JTable();
        jPanel4 = new javax.swing.JPanel();
        jLabel5 = new javax.swing.JLabel();
        jTextFieldidentificacion = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jComboBoxProducto1 = new javax.swing.JComboBox();
        eliminar = new javax.swing.JButton();
        modificar = new javax.swing.JButton();
        jLabel14 = new javax.swing.JLabel();
        jComboBoxestado1 = new javax.swing.JComboBox();
        jTextFieldOperario1 = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        jLabel19 = new javax.swing.JLabel();
        jDateChooserSelectorFecha1 = new com.toedter.calendar.JDateChooser();
        jComboBoxUbicacion1 = new javax.swing.JComboBox();
        jLabel20 = new javax.swing.JLabel();
        jComboBoxBuscarubicacion = new javax.swing.JComboBox();
        jButton2 = new javax.swing.JButton();
        jPanel3 = new javax.swing.JPanel();
        jScrollPane5 = new javax.swing.JScrollPane();
        ButtBuscar = new javax.swing.JPanel();
        jTextFieldestadolagar = new javax.swing.JTextField();
        jLabelDniCon = new javax.swing.JLabel();
        jLabelTelCon = new javax.swing.JLabel();
        jTextFielproducto = new javax.swing.JTextField();
        jButtonBuscarCon = new javax.swing.JButton();
        jLabelApellidoCon = new javax.swing.JLabel();
        jComboBoxIdentificacion = new javax.swing.JComboBox();
        jLabel7 = new javax.swing.JLabel();
        jTextFieldubicacion = new javax.swing.JTextField();
        jLabel21 = new javax.swing.JLabel();
        jLabel22 = new javax.swing.JLabel();
        jTextFieldfechaalta = new javax.swing.JTextField();
        jTextFieldoperario = new javax.swing.JTextField();
        jButtonSalir = new javax.swing.JButton();
        jPanel7 = new javax.swing.JPanel();
        jTextFieldUsuario2 = new javax.swing.JTextField();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Gestionar Lagares - Sistema Gestor de Pesaje para Bodegas");

        jTabbedPane1.setForeground(new java.awt.Color(102, 0, 102));
        jTabbedPane1.setFont(new java.awt.Font("Segoe UI", 3, 12));

        jPanel1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        jButtonGuardar.setFont(new java.awt.Font("Segoe UI", 3, 12));
        jButtonGuardar.setForeground(new java.awt.Color(102, 0, 102));
        jButtonGuardar.setText("Guardar");
        jButtonGuardar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonGuardarActionPerformed(evt);
            }
        });

        jLabel4.setFont(new java.awt.Font("Segoe UI", 1, 11));
        jLabel4.setText("Identificación:");

        jTextFieldIdentificacion.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        jLabel2.setFont(new java.awt.Font("Segoe UI", 1, 11));
        jLabel2.setText("Ubicación:");

        jComboBoxUbicacion.setFont(new java.awt.Font("Segoe UI", 1, 11));
        jComboBoxUbicacion.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "NORTE", "SUR", "ESTE", "OESTE", "" }));
        jComboBoxUbicacion.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.LOWERED));
        jComboBoxUbicacion.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jComboBoxUbicacionMouseClicked(evt);
            }
            public void mousePressed(java.awt.event.MouseEvent evt) {
                jComboBoxUbicacionMousePressed(evt);
            }
        });
        jComboBoxUbicacion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxUbicacionActionPerformed(evt);
            }
        });

        jLabel18.setFont(new java.awt.Font("Segoe UI", 1, 11));
        jLabel18.setText("Estado:");

        jLabel1.setFont(new java.awt.Font("Segoe UI", 1, 11));
        jLabel1.setText("Producto:");

        jLabel10.setFont(new java.awt.Font("Segoe UI", 1, 11));
        jLabel10.setText("Fecha:");

        jDateChooserSelectorFecha.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        jComboBoxEstado.setFont(new java.awt.Font("Segoe UI", 1, 11));
        jComboBoxEstado.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "ACTIVO", "ANULADO", "EN REPARACION", "EN LIMPIEZA", "BAJA", " " }));
        jComboBoxEstado.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        jComboBoxProducto.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel4)
                    .addComponent(jLabel2)
                    .addComponent(jLabel10)
                    .addComponent(jLabel18)
                    .addComponent(jLabel1))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jTextFieldIdentificacion, javax.swing.GroupLayout.PREFERRED_SIZE, 400, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(jDateChooserSelectorFecha, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jComboBoxProducto, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jComboBoxEstado, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jComboBoxUbicacion, javax.swing.GroupLayout.Alignment.LEADING, 0, 180, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jButtonGuardar))))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(37, 37, 37)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(jTextFieldIdentificacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(jComboBoxUbicacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(33, 33, 33)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel18)
                    .addComponent(jComboBoxEstado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(30, 30, 30)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jComboBoxProducto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1))
                .addGap(26, 26, 26)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(jLabel10)
                        .addComponent(jDateChooserSelectorFecha, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jButtonGuardar))
                .addGap(316, 316, 316))
        );

        jTabbedPane1.addTab("Alta Lagar", jPanel1);

        jScrollPane2.setAutoscrolls(true);

        jTableLagares.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
        jTableLagares.setFont(new java.awt.Font("Segoe UI", 0, 11));
        jTableLagares.setAutoscrolls(false);
        jTableLagares.setFillsViewportHeight(true);
        jTableLagares.setMinimumSize(new java.awt.Dimension(55, 55));
        jTableLagares.setPreferredSize(new java.awt.Dimension(200, 42));
        jTableLagares.setRowHeight(14);
        jTableLagares.getTableHeader().setResizingAllowed(false);
        jTableLagares.getTableHeader().setReorderingAllowed(false);

        org.jdesktop.swingbinding.JTableBinding jTableBinding = org.jdesktop.swingbinding.SwingBindings.createJTableBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, lagarList4, jTableLagares);
        bindingGroup.addBinding(jTableBinding);
        jTableBinding.bind();
        jTableLagares.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jTableLagaresMouseClicked(evt);
            }
        });
        jScrollPane3.setViewportView(jTableLagares);

        jScrollPane2.setViewportView(jScrollPane3);

        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED), "Datos Lagar", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Segoe UI", 3, 11), new java.awt.Color(102, 0, 102))); // NOI18N

        jLabel5.setFont(new java.awt.Font("Segoe UI", 1, 11));
        jLabel5.setText("Identificacion:");

        jTextFieldidentificacion.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
        jTextFieldidentificacion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextFieldidentificacionActionPerformed(evt);
            }
        });

        jLabel3.setFont(new java.awt.Font("Segoe UI", 1, 11));
        jLabel3.setText("Producto:");

        jLabel6.setFont(new java.awt.Font("Segoe UI", 1, 11));
        jLabel6.setText("Estado:");

        jComboBoxProducto1.setFont(new java.awt.Font("Segoe UI", 0, 11));
        jComboBoxProducto1.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        eliminar.setFont(new java.awt.Font("Segoe UI", 3, 11));
        eliminar.setForeground(new java.awt.Color(102, 0, 102));
        eliminar.setText("Eliminar");
        eliminar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eliminarActionPerformed(evt);
            }
        });

        modificar.setFont(new java.awt.Font("Segoe UI", 3, 11));
        modificar.setForeground(new java.awt.Color(102, 0, 102));
        modificar.setText("Modificar");
        modificar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                modificarActionPerformed(evt);
            }
        });

        jLabel14.setFont(new java.awt.Font("Segoe UI", 1, 11));
        jLabel14.setText("Ubicación:");

        jComboBoxestado1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "ACTIVO", "ANULADO", "EN REPARACION", "EN LIMPIEZA", "BAJA" }));
        jComboBoxestado1.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        jTextFieldOperario1.setEditable(false);
        jTextFieldOperario1.setFont(new java.awt.Font("Segoe UI", 0, 11));
        jTextFieldOperario1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
        jTextFieldOperario1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextFieldOperario1ActionPerformed(evt);
            }
        });

        jLabel11.setFont(new java.awt.Font("Segoe UI", 1, 11));
        jLabel11.setText("Operario:");

        jLabel19.setFont(new java.awt.Font("Segoe UI", 1, 11));
        jLabel19.setText("Fecha:");

        jComboBoxUbicacion1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "NORTE", "SUR", "ESTE", "OESTE" }));
        jComboBoxUbicacion1.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel14)
                            .addComponent(jLabel5)
                            .addComponent(jLabel3)
                            .addComponent(jLabel6)
                            .addComponent(jLabel11))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jComboBoxUbicacion1, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jTextFieldidentificacion)
                            .addComponent(jComboBoxProducto1, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jComboBoxestado1, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jTextFieldOperario1, javax.swing.GroupLayout.DEFAULT_SIZE, 263, Short.MAX_VALUE))
                        .addGap(18, 18, 18)
                        .addComponent(jLabel19)
                        .addGap(18, 18, 18)
                        .addComponent(jDateChooserSelectorFecha1, javax.swing.GroupLayout.PREFERRED_SIZE, 213, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
                        .addComponent(modificar)
                        .addGap(18, 18, 18)
                        .addComponent(eliminar)))
                .addContainerGap())
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel14)
                            .addComponent(jComboBoxUbicacion1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel5)
                            .addComponent(jTextFieldidentificacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel3)
                            .addComponent(jComboBoxProducto1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jComboBoxestado1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel6)))
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jDateChooserSelectorFecha1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel19))))
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(eliminar)
                        .addComponent(modificar))
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel11)
                            .addComponent(jTextFieldOperario1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap())
        );

        jLabel20.setFont(new java.awt.Font("Segoe UI", 1, 11));
        jLabel20.setText("Ubicación:");

        jComboBoxBuscarubicacion.setFont(new java.awt.Font("Segoe UI", 1, 11));
        jComboBoxBuscarubicacion.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "NORTE", "SUR", "ESTE", "OESTE", " " }));
        jComboBoxBuscarubicacion.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        jButton2.setFont(new java.awt.Font("Segoe UI", 3, 11));
        jButton2.setForeground(new java.awt.Color(102, 0, 102));
        jButton2.setText("Buscar");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 477, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel20)
                        .addGap(18, 18, 18)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jButton2)
                            .addComponent(jComboBoxBuscarubicacion, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap(65, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(24, 24, 24)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel20)
                            .addComponent(jComboBoxBuscarubicacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jButton2)))
                .addGap(18, 18, 18)
                .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(122, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Modificar/Eliminar", jPanel2);

        jScrollPane5.setAutoscrolls(true);

        ButtBuscar.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "Datos del Lagar", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Segoe UI", 3, 12), new java.awt.Color(102, 0, 102))); // NOI18N

        jTextFieldestadolagar.setEditable(false);
        jTextFieldestadolagar.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        jLabelDniCon.setFont(new java.awt.Font("Segoe UI", 1, 11));
        jLabelDniCon.setText("Estado:");

        jLabelTelCon.setFont(new java.awt.Font("Segoe UI", 1, 11));
        jLabelTelCon.setText("Producto:");

        jTextFielproducto.setEditable(false);
        jTextFielproducto.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        jButtonBuscarCon.setFont(new java.awt.Font("Segoe UI", 3, 12));
        jButtonBuscarCon.setForeground(new java.awt.Color(102, 0, 102));
        jButtonBuscarCon.setMnemonic('B');
        jButtonBuscarCon.setText("Buscar");
        jButtonBuscarCon.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonBuscarConActionPerformed(evt);
            }
        });

        jLabelApellidoCon.setFont(new java.awt.Font("Segoe UI", 1, 11));
        jLabelApellidoCon.setText("Identificación:");

        jComboBoxIdentificacion.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                jComboBoxIdentificacionMousePressed(evt);
            }
        });
        jComboBoxIdentificacion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxIdentificacionActionPerformed(evt);
            }
        });

        jLabel7.setFont(new java.awt.Font("Segoe UI", 1, 11));
        jLabel7.setText("Ubicacion:");

        jTextFieldubicacion.setEditable(false);
        jTextFieldubicacion.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        jLabel21.setFont(new java.awt.Font("Segoe UI", 1, 11));
        jLabel21.setText("Fecha de Alta:");

        jLabel22.setFont(new java.awt.Font("Segoe UI", 1, 11));
        jLabel22.setText("Operario:");

        jTextFieldfechaalta.setEditable(false);
        jTextFieldfechaalta.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        jTextFieldoperario.setEditable(false);
        jTextFieldoperario.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
        jTextFieldoperario.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextFieldoperarioActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout ButtBuscarLayout = new javax.swing.GroupLayout(ButtBuscar);
        ButtBuscar.setLayout(ButtBuscarLayout);
        ButtBuscarLayout.setHorizontalGroup(
            ButtBuscarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(ButtBuscarLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(ButtBuscarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(ButtBuscarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(ButtBuscarLayout.createSequentialGroup()
                            .addComponent(jLabel21)
                            .addContainerGap(642, Short.MAX_VALUE))
                        .addGroup(ButtBuscarLayout.createSequentialGroup()
                            .addGroup(ButtBuscarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(ButtBuscarLayout.createSequentialGroup()
                                    .addGroup(ButtBuscarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jLabelDniCon)
                                        .addComponent(jLabelApellidoCon)
                                        .addComponent(jLabel7)
                                        .addComponent(jLabelTelCon))
                                    .addGap(33, 33, 33)
                                    .addGroup(ButtBuscarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jTextFielproducto, javax.swing.GroupLayout.DEFAULT_SIZE, 330, Short.MAX_VALUE)
                                        .addComponent(jTextFieldubicacion, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 330, Short.MAX_VALUE)
                                        .addComponent(jTextFieldestadolagar, javax.swing.GroupLayout.DEFAULT_SIZE, 330, Short.MAX_VALUE)
                                        .addComponent(jComboBoxIdentificacion, javax.swing.GroupLayout.Alignment.TRAILING, 0, 330, Short.MAX_VALUE)
                                        .addComponent(jTextFieldfechaalta, javax.swing.GroupLayout.DEFAULT_SIZE, 330, Short.MAX_VALUE)
                                        .addComponent(jTextFieldoperario, javax.swing.GroupLayout.DEFAULT_SIZE, 330, Short.MAX_VALUE))
                                    .addGap(93, 93, 93))
                                .addGroup(ButtBuscarLayout.createSequentialGroup()
                                    .addComponent(jLabel22)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 388, Short.MAX_VALUE)))
                            .addGap(186, 186, 186)))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, ButtBuscarLayout.createSequentialGroup()
                        .addComponent(jButtonBuscarCon)
                        .addGap(130, 130, 130))))
        );
        ButtBuscarLayout.setVerticalGroup(
            ButtBuscarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(ButtBuscarLayout.createSequentialGroup()
                .addGroup(ButtBuscarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(ButtBuscarLayout.createSequentialGroup()
                        .addGroup(ButtBuscarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabelApellidoCon)
                            .addComponent(jComboBoxIdentificacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(ButtBuscarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel7)
                            .addComponent(jTextFieldubicacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(ButtBuscarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabelDniCon)
                            .addComponent(jTextFieldestadolagar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(ButtBuscarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabelTelCon)
                            .addComponent(jTextFielproducto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(ButtBuscarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel21)
                            .addComponent(jTextFieldfechaalta, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(ButtBuscarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel22)
                            .addComponent(jTextFieldoperario, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(jButtonBuscarCon))
                .addContainerGap(205, Short.MAX_VALUE))
        );

        jScrollPane5.setViewportView(ButtBuscar);

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 727, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(32, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 403, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(19, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Listar Lagar", jPanel3);

        jButtonSalir.setFont(new java.awt.Font("Segoe UI", 3, 12));
        jButtonSalir.setForeground(new java.awt.Color(102, 0, 102));
        jButtonSalir.setText("Salir");
        jButtonSalir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonSalirActionPerformed(evt);
            }
        });

        jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED), "Usuario Registrado", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Segoe UI", 3, 11), new java.awt.Color(102, 0, 102))); // NOI18N
        jPanel7.setForeground(new java.awt.Color(102, 0, 102));
        jPanel7.setFont(new java.awt.Font("Segoe UI", 3, 12));

        jTextFieldUsuario2.setEditable(false);
        jTextFieldUsuario2.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createSequentialGroup()
                .addContainerGap(16, Short.MAX_VALUE)
                .addComponent(jTextFieldUsuario2, javax.swing.GroupLayout.PREFERRED_SIZE, 191, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jTextFieldUsuario2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(28, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(jButtonSalir)
                        .addGap(33, 33, 33))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 774, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(91, 91, 91)
                        .addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGap(63, 63, 63))))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 463, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(34, 34, 34)
                        .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButtonSalir)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        bindingGroup.bind();

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-1183)/2, (screenSize.height-554)/2, 1183, 554);
    }// </editor-fold>//GEN-END:initComponents

    private void refresh() {
        jTextFieldIdentificacion.setText("");
       

     
    }

private void jButtonSalirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonSalirActionPerformed
    this.dispose();
}//GEN-LAST:event_jButtonSalirActionPerformed

private void jTextFieldoperarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldoperarioActionPerformed
    // TODO add your handling code here:
}//GEN-LAST:event_jTextFieldoperarioActionPerformed

private void jComboBoxIdentificacionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxIdentificacionActionPerformed

}//GEN-LAST:event_jComboBoxIdentificacionActionPerformed

private void jComboBoxIdentificacionMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jComboBoxIdentificacionMousePressed
    limpiarDatos();    // TODO add your handling code here:
    cargarComboIdentificacion();
}//GEN-LAST:event_jComboBoxIdentificacionMousePressed

private void jButtonBuscarConActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonBuscarConActionPerformed
    ///////////////

    System.out.println("");
    Lagar lagar= null;
    Estadolagar estadol=null;
    Object estl = jComboBoxIdentificacion.getSelectedItem();
    String identif = estl.toString();
    System.out.println("identif " + identif);
    try {
        estadol = controladorestlag.buscarLagarIdentificacion(identif);
        System.out.println("identificacion lagar " + estl);
    } catch (Exception e) {
        JOptionPane.showMessageDialog(this, "No se ha encontrado el lagar especificado.\n ", "Lagar", JOptionPane.ERROR_MESSAGE);
    }

    if (estl != null) {

        jTextFieldubicacion.setText(estadol.getIdLagar().getUbicacion());
        jTextFieldestadolagar.setText(estadol.getEstado());
        jTextFielproducto.setText(estadol.getIdLagar().getProducto().getNombreProducto());
        jTextFieldfechaalta.setText(estadol.getIdLagar().getFechaLagar());
        jTextFieldoperario.setText(estadol.getIdLagar().getOperario().getApellido());


    }
}//GEN-LAST:event_jButtonBuscarConActionPerformed

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed

    cargarTablaporUbicacion();// TODO add your handling code here:
}//GEN-LAST:event_jButton2ActionPerformed

private void jTextFieldOperario1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldOperario1ActionPerformed
    // TODO add your handling code here:
}//GEN-LAST:event_jTextFieldOperario1ActionPerformed

private void modificarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_modificarActionPerformed
        try {
            boolean ver = false;
            int fila = jTableLagares.getSelectedRow();
            Lagar l = new Lagar();
            l = (Lagar) lagarList4.get(fila);
            Lagar lagaramodificar = controladorlagar.buscarLagar_X_idLagar(l.getIdLagar());
            System.out.println(l.getIdLagar());
//            oper = ctrloperario.buscarOperarioApellido(operario);
            if (fila < 0) {
                JOptionPane.showMessageDialog(this, "Debe seleccionar un Lagar para modificar!", "Modificar Lagar", JOptionPane.INFORMATION_MESSAGE);
            } else {
                String ubicacion = jComboBoxUbicacion1.getSelectedItem().toString();
                String identificacion = jTextFieldidentificacion.getText();
                String prod = jComboBoxProducto1.getSelectedItem().toString();
                String estado = jComboBoxestado1.getSelectedItem().toString();
                String operarioLagar = jTextFieldOperario1.getText().toString();
             //   fecha = jDateChooserSelectorFecha1.getDateFormatString();
                try {
                    producto = controladorprod.buscarProductoNombre(prod);
                } catch (Exception ex) {
                    Logger.getLogger(ABMLagar.class.getName()).log(Level.SEVERE, null, ex);
                }
                try {
                    // fecha debe ser menor o igual a la fecha actual;
                    String formato = "dd/MM/yyyy";
                    Date date = jDateChooserSelectorFecha1.getDate();
                    SimpleDateFormat sdf = new SimpleDateFormat(formato);
                    fecha = sdf.format(date);
                    int año = jDateChooserSelectorFecha1.getCalendar().get(Calendar.YEAR);
                    int mes = jDateChooserSelectorFecha1.getCalendar().get(Calendar.MONTH) + 1;
                    int dia = jDateChooserSelectorFecha1.getCalendar().get(Calendar.DAY_OF_MONTH);
                    System.out.println("" + dia);
                    System.out.println("" + mes);
                    System.out.println("" + año);
                } catch (NullPointerException ex) {
                    JOptionPane.showMessageDialog(this, "Seleccione una fecha por favor!", "Error!", JOptionPane.INFORMATION_MESSAGE);
                }
                if (verificar(identificacion, ubicacion, estado, prod)) {
                    lagaramodificar.setFechaLagar(fecha);
                    lagaramodificar.setOperario(o);
                    lagaramodificar.setProducto(producto);
                    lagaramodificar.setUbicacion(ubicacion);
                    try {
                        controladorlagar.modificarLagar(lagaramodificar);
                    } catch (Exception e) {
                    }
                    estadolagar = controladorestlag.findLagar(lagaramodificar);
                    estadolagar.setEstado(estado);
                    estadolagar.setIdentificacion(identificacion);
                  //  estadolagar.setIdLagar(lagaramodificar);
                    try {
                        controladorestlag.modificarEstadoLagar(estadolagar);
                    } catch (Exception ex) {
                        ex.printStackTrace();
                    }
                    JOptionPane.showMessageDialog(this, "Modificación realizada", "Modificar producto", JOptionPane.INFORMATION_MESSAGE);
                    cargarTabla();
                    limpiarcampos();
                }
            }
        } catch (Exception ex) {
            Logger.getLogger(ABMLagar.class.getName()).log(Level.SEVERE, null, ex);
        }
}//GEN-LAST:event_modificarActionPerformed

private void eliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_eliminarActionPerformed
        try {
            //ESTE CODIGO ELIMINA EL LAGAR AGREGO EL OTRO CODIGO PARA MARCARLO EN BAJA SIN ELIMINAR
            /*    int ind = jTableLagares.getSelectedRow();
            if (ind < 0) {
            JOptionPane.showMessageDialog(this, "Debe seleccionar un Lagar para eliminar!", "ABMLagar", JOptionPane.INFORMATION_MESSAGE);
            } else {
            Lagar l = (Lagar) lagarList4.get(ind);
            int rta = JOptionPane.showConfirmDialog(this, "Esta seguro de que desea ELIMINAR el Lagar\n= "+l.toString(), "Consulta Producto", JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE);
            if (rta == 0) {
            try {
            Lagar lagaraeliminar=controladorlagar.buscarLagar_X_idLagar(l.getIdLagar());
            Estadolagar eliminarestadolagar =controladorestlag.buscarEstadolagar_X_idEstadolagar(lagaraeliminar.getIdLagar());
            controladorestlag.eliminarEstadoLagar(eliminarestadolagar);
            controladorlagar.eliminarLagar(lagaraeliminar);
            } catch (Exception ex) {
            JOptionPane.showMessageDialog(this, "Eliminacion realizada ", "Eliminar Lagar", JOptionPane.INFORMATION_MESSAGE);
            }
            //   JOptionPane.showMessageDialog(this, "Eliminación realizada", "Eliminar Lagar", JOptionPane.INFORMATION_MESSAGE);
            cargarTabla();
            limpiarCampos();
            }
            }*/
            boolean ver = false;
            int fila = jTableLagares.getSelectedRow();
            Lagar l = new Lagar();
            l = (Lagar) lagarList4.get(fila);
            Lagar lagaramodificar = controladorlagar.buscarLagar_X_idLagar(l.getIdLagar());
            System.out.println(l.getIdLagar());
//            oper = ctrloperario.buscarOperarioApellido(operario);
            if (fila < 0) {
                JOptionPane.showMessageDialog(this, "Debe seleccionar un Lagar a dar de baja!", "Modificar Lagar", JOptionPane.INFORMATION_MESSAGE);
            } else {
                String ubicacion = jComboBoxUbicacion1.getSelectedItem().toString();
                String identificacion = jTextFieldidentificacion.getText();
                String prod = jComboBoxProducto1.getSelectedItem().toString();
                String estado = jComboBoxestado1.getSelectedItem().toString();
                String operarioLagar = jTextFieldOperario1.getText().toString();
                fecha = jDateChooserSelectorFecha1.getDateFormatString();
                try {
                    producto = controladorprod.buscarProductoNombre(prod);
                } catch (Exception ex) {
                    Logger.getLogger(ABMLagar.class.getName()).log(Level.SEVERE, null, ex);
                }
                fechaBaja = "";
                try {
                    // fecha debe ser menor o igual a la fecha actual;
                    String formato = "dd/MM/yyyy";
                    Date date = jDateChooserSelectorFecha1.getDate();
                    SimpleDateFormat sdf = new SimpleDateFormat(formato);
                    fecha = sdf.format(date);
                    int año = jDateChooserSelectorFecha1.getCalendar().get(Calendar.YEAR);
                    int mes = jDateChooserSelectorFecha1.getCalendar().get(Calendar.MONTH) + 1;
                    int dia = jDateChooserSelectorFecha1.getCalendar().get(Calendar.DAY_OF_MONTH);
                    System.out.println("" + dia);
                    System.out.println("" + mes);
                    System.out.println("" + año);
                } catch (NullPointerException ex) {
                    JOptionPane.showMessageDialog(this, "Seleccione una fecha por favor!", "Error!", JOptionPane.INFORMATION_MESSAGE);
                }
                if (verificar1(identificacion, ubicacion, estado, prod)) {
                    lagaramodificar.setFechaLagar(fecha);
                    lagaramodificar.setOperario(o);
                    lagaramodificar.setProducto(producto);
                    lagaramodificar.setUbicacion(ubicacion);
                    try {
                        controladorlagar.modificarLagar(lagaramodificar);
                    } catch (Exception e) {
                    }
                    estadolagar = controladorestlag.findLagar(lagaramodificar);
                    estadolagar.setEstado(estado);
                    estadolagar.setIdentificacion(identificacion);
                    estadolagar.setIdLagar(lagaramodificar);
                    try {
                        controladorestlag.modificarEstadoLagar(estadolagar);
                    } catch (Exception ex) {
                        ex.printStackTrace();
                    }
                    JOptionPane.showMessageDialog(this, "Baja realizada", "Baja Lagar", JOptionPane.INFORMATION_MESSAGE);
                    cargarTabla();
                    limpiarcampos();
                }
            }
        } catch (Exception ex) {
            Logger.getLogger(ABMLagar.class.getName()).log(Level.SEVERE, null, ex);
        }


}//GEN-LAST:event_eliminarActionPerformed

private void jTextFieldidentificacionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldidentificacionActionPerformed

}//GEN-LAST:event_jTextFieldidentificacionActionPerformed

private void jTableLagaresMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTableLagaresMouseClicked

    cargarCampos();
}//GEN-LAST:event_jTableLagaresMouseClicked

private void jComboBoxUbicacionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxUbicacionActionPerformed

 
    
}//GEN-LAST:event_jComboBoxUbicacionActionPerformed

private void jComboBoxUbicacionMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jComboBoxUbicacionMousePressed

}//GEN-LAST:event_jComboBoxUbicacionMousePressed

private void jComboBoxUbicacionMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jComboBoxUbicacionMouseClicked

}//GEN-LAST:event_jComboBoxUbicacionMouseClicked

private void jButtonGuardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonGuardarActionPerformed
        try {
            nombre = jTextFieldIdentificacion.getText();
            String ubicacion = jComboBoxUbicacion.getSelectedItem().toString();
            String estado = jComboBoxEstado.getSelectedItem().toString();
            String nombproducto = jComboBoxProducto.getSelectedItem().toString();
            fecha = jDateChooserSelectorFecha.getDateFormatString();
//            oper = ctrloperario.buscarOperarioApellido(operario);
            String nombreprod = jComboBoxProducto.getSelectedItem().toString();
            try {
                producto = controladorprod.buscarProductoNombre(nombreprod);
                System.out.println(producto + "producto");
            } catch (Exception e) {
            }
            fechaAlta = Validador.getInstance().obtenerFechaSistema();
            fechaBaja = "";
            try {
                // fecha debe ser menor o igual a la fecha actual;
                String formato = "dd/MM/yyyy";
                Date date = jDateChooserSelectorFecha.getDate();
                SimpleDateFormat sdf = new SimpleDateFormat(formato);
                fecha = sdf.format(date);
                int año = jDateChooserSelectorFecha.getCalendar().get(Calendar.YEAR);
                int mes = jDateChooserSelectorFecha.getCalendar().get(Calendar.MONTH) + 1;
                int dia = jDateChooserSelectorFecha.getCalendar().get(Calendar.DAY_OF_MONTH);
                System.out.println("" + dia);
                System.out.println("" + mes);
                System.out.println("" + año);
            } catch (NullPointerException ex) {
                JOptionPane.showMessageDialog(this, "Seleccione una fecha por favor!", "Error!", JOptionPane.INFORMATION_MESSAGE);
            }
            if (verificar(nombre, ubicacion, estado, nombproducto)) {
                Lagar lagar = new Lagar();
                lagar.setFechaLagar(fecha);
                lagar.setOperario(o);
                lagar.setProducto(producto);
                lagar.setUbicacion(ubicacion);
                try {
                    controladorlagar.guardarLagar(lagar);
                } catch (Exception e) {
                }
                Estadolagar estadolagar = new Estadolagar();
                estadolagar.setIdentificacion(nombre);
                estadolagar.setIdLagar(lagar);
                estadolagar.setEstado(estado);
                try {
                    controladorestlag.modificarEstadoLagar(estadolagar);
                } catch (Exception e) {
                }
                JOptionPane.showMessageDialog(this, "Alta Registrada", "Alta Lagar", JOptionPane.INFORMATION_MESSAGE);
                cargarTabla();
                limpiarcampos1();
            }
        } catch (Exception ex) {
            Logger.getLogger(ABMLagar.class.getName()).log(Level.SEVERE, null, ex);
        }

}//GEN-LAST:event_jButtonGuardarActionPerformed
private boolean verificar(String identif, String ubicacion, String estado, String producto) {
        boolean ver = false;
        if (identif.equals("") || ubicacion.equals("") || estado.equals("")|| producto.equals("")) {
            JOptionPane.showMessageDialog(this, "Por favor llene todos los campos!!!", "Error", JOptionPane.ERROR_MESSAGE);

        } else if (!validador.getInstance().soloContieneLetrasYNumerosYEspacios(identif)) {
            JOptionPane.showMessageDialog(this, "Nombre invalido!!!", "Error", JOptionPane.ERROR_MESSAGE);

}/* else if (!estado.equals("BAJA")) {
            JOptionPane.showMessageDialog(this, "SELECCIONE ESTADO DE BAJA", "Error", JOptionPane.ERROR_MESSAGE);
        } */else {
            ver = true;
        }
        return ver;
    }


private boolean verificar1(String identif, String ubicacion, String estado, String producto) {
        boolean ver = false;
        if (identif.equals("") || ubicacion.equals("") || estado.equals("")|| producto.equals("")) {
            JOptionPane.showMessageDialog(this, "Por favor llene todos los campos!!!", "Error", JOptionPane.ERROR_MESSAGE);

        } else if (!validador.getInstance().soloContieneLetrasYNumerosYEspacios(identif)) {
            JOptionPane.showMessageDialog(this, "Nombre invalido!!!", "Error", JOptionPane.ERROR_MESSAGE);

} else if (!estado.equals("BAJA")) {
            JOptionPane.showMessageDialog(this, "SELECCIONE ESTADO DE BAJA", "Error", JOptionPane.ERROR_MESSAGE);
        } else {
            ver = true;
        }
        return ver;
    }

    private void cargarCampos()  {

        int fila = jTableLagares.getSelectedRow();
        Lagar l = new Lagar();
        Estadolagar el = new Estadolagar();
        l = (Lagar) lagarListaUbicacion.get(fila);
        System.out.println(l.getIdLagar()+": id lagar de la fila lagarlist4 de la tabla el renglon");
              Lagar la= controladorlagar.buscarLagar_X_idLagar(l.getIdLagar());
              el=controladorestlag.findLagar(l);

                     System.out.println(el.getIdEstadoLagar()+": estado lagar id de lagar"+el.getIdLagar());

                       jTextFieldidentificacion.setText(el.getIdentificacion());
                       jTextFieldOperario1.setText(el.getIdLagar().getOperario().getApellido());
                       jComboBoxUbicacion1.setSelectedItem(el.getIdLagar().getUbicacion());
                       jComboBoxProducto1.setSelectedItem(el.getIdLagar().getProducto().getNombreProducto());
                       jComboBoxestado1.setSelectedItem(el.getEstado());
                     //  jDateChooserSelectorFecha1 .setDateFormatString(el.getIdLagar().getFechaLagar());
//limpiarCampos();
      
    }

    private void cargarTablaporUbicacion() {
       String[] encabezados = new String[3];
        encabezados[0] = "Fecha";
        encabezados[1] = "Producto";
        encabezados[2] = "Operario";
    
     
    String ubicacion = jComboBoxBuscarubicacion.getSelectedItem().toString();
     System.out.println(ubicacion);
     lagarListaUbicacion = controladorlagar.buscarLagar_x_Ubicacion(ubicacion);
    System.out.println(lagarListaUbicacion);
       tableModel = new TablaPersonalizada(encabezados);
      jTableLagares.setModel(tableModel);

        try {
          
       

            for (int i = 0; i < lagarList4.size(); i++) {
                Vector fila = new Vector();
                Lagar lagares = (Lagar) lagarListaUbicacion.get(i);
            System.out.println(lagares);
                fila.add(lagares.getFechaLagar());
                fila.add(lagares.getProducto().getNombreProducto());
           
                fila.add(lagares.getOperario().getApellido());
               
                tableModel.addRow(fila);
            }
        } catch (Exception e) {
        }
    }

    private void cargarTabla() {
       String[] encabezados = new String[3];
        encabezados[0] = "Fecha";
        encabezados[1] = "Producto";
        encabezados[2] = "Operario";

    

       tableModel = new TablaPersonalizada(encabezados);
      jTableLagares.setModel(tableModel);

        try {
             lista = controladorlagar.buscarTodosLagar();
            System.out.println("tamaño de listao" + lista.size());



            for (int i = 0; i < lista.size(); i++) {
                Vector fila = new Vector();
                Lagar lagares = (Lagar) lista.get(i);
                fila.add(lagares.getFechaLagar());
                fila.add(lagares.getProducto().getNombreProducto());
                fila.add(lagares.getOperario().getApellido());
                tableModel.addRow(fila);
            }
        } catch (Exception e) {
        }
    }

    private void limpiarCampos() {
        jTextFieldidentificacion.setText("");
   jComboBoxProducto1.setSelectedItem("");
   jComboBoxestado1.setSelectedItem("");
   jTextFieldOperario1.setText("");
   

    }


    private void cargarComboNombreProducto() {
        try {
            lista = controladorprod.buscarTodosProducto();
            System.out.println("tamaño de la lista de Producto " + lista.size());
        } catch (Exception e) {
        }
        jComboBoxIdentificacion.removeAllItems();
        for (int i = 0; i < lista.size(); i++) {
            Vector fila = new Vector();
            Producto prod = (Producto) lista.get(i);
            fila.add(prod.getNombreProducto());
            jComboBoxIdentificacion.addItem(fila.get(0));
        }
    }



    private boolean verificar(String descripcion, String nomclasificacion, String precio) {
        boolean ver = false;
        if (descripcion.equals("") || nomclasificacion.equals("") || precio.equals("")) {
            JOptionPane.showMessageDialog(this, "Por favor llene todos los campos!!!", "Error", JOptionPane.ERROR_MESSAGE);

        } else if (!validador.getInstance().soloContieneLetrasYNumerosYEspacios(descripcion)) {
            JOptionPane.showMessageDialog(this, "Descripción invalido!!!", "Error", JOptionPane.ERROR_MESSAGE);

        } else if (!validador.getInstance().soloContieneNumerosYPuntos(precio)) {
            JOptionPane.showMessageDialog(this, "Precio invalido!!!", "Error", JOptionPane.ERROR_MESSAGE);

        } else {
            ver = true;
        }
        return ver;
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel ButtBuscar;
    private javax.persistence.EntityManager GestorPesajeJpaPU2EntityManager;
    private javax.swing.JButton eliminar;
    private java.util.List<Entidades.Estadolagar> estadolagarList;
    private java.util.List<Entidades.Estadolagar> estadolagarList1;
    private java.util.List<Entidades.Estadolagar> estadolagarList2;
    private javax.persistence.Query estadolagarQuery;
    private javax.persistence.Query estadolagarQuery1;
    private javax.persistence.Query estadolagarQuery2;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButtonBuscarCon;
    private javax.swing.JButton jButtonGuardar;
    private javax.swing.JButton jButtonSalir;
    private javax.swing.JComboBox jComboBoxBuscarubicacion;
    private javax.swing.JComboBox jComboBoxEstado;
    private javax.swing.JComboBox jComboBoxIdentificacion;
    private javax.swing.JComboBox jComboBoxProducto;
    private javax.swing.JComboBox jComboBoxProducto1;
    private javax.swing.JComboBox jComboBoxUbicacion;
    private javax.swing.JComboBox jComboBoxUbicacion1;
    private javax.swing.JComboBox jComboBoxestado1;
    private com.toedter.calendar.JDateChooser jDateChooserSelectorFecha;
    private com.toedter.calendar.JDateChooser jDateChooserSelectorFecha1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabelApellidoCon;
    private javax.swing.JLabel jLabelDniCon;
    private javax.swing.JLabel jLabelTelCon;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTable jTableLagares;
    private javax.swing.JTextField jTextFieldIdentificacion;
    private javax.swing.JTextField jTextFieldOperario1;
    private javax.swing.JTextField jTextFieldUsuario2;
    private javax.swing.JTextField jTextFieldestadolagar;
    private javax.swing.JTextField jTextFieldfechaalta;
    private javax.swing.JTextField jTextFieldidentificacion;
    private javax.swing.JTextField jTextFieldoperario;
    private javax.swing.JTextField jTextFieldubicacion;
    private javax.swing.JTextField jTextFielproducto;
    private java.util.List<Entidades.Lagar> lagarList;
    private java.util.List<Entidades.Lagar> lagarList1;
    private java.util.List<Entidades.Lagar> lagarList2;
    private java.util.List<Entidades.Lagar> lagarList3;
    private java.util.List<Entidades.Lagar> lagarList4;
    private javax.persistence.Query lagarQuery;
    private javax.persistence.Query lagarQuery1;
    private javax.persistence.Query lagarQuery2;
    private javax.persistence.Query lagarQuery3;
    private javax.persistence.Query lagarQuery4;
    private javax.swing.JButton modificar;
    private java.util.List<Entidades.Producto> productoList;
    private java.util.List<Entidades.Producto> productoList1;
    private java.util.List<Entidades.Producto> productoList2;
    private java.util.List<Entidades.Producto> productoList3;
    private java.util.List<Entidades.Producto> productoList4;
    private java.util.List<Entidades.Producto> productoList5;
    private java.util.List<Entidades.Producto> productoList6;
    private java.util.List<Entidades.Producto> productoList7;
    private javax.persistence.Query productoQuery;
    private javax.persistence.Query productoQuery1;
    private javax.persistence.Query productoQuery2;
    private javax.persistence.Query productoQuery3;
    private javax.persistence.Query productoQuery4;
    private javax.persistence.Query productoQuery5;
    private javax.persistence.Query productoQuery6;
    private javax.persistence.Query productoQuery7;
    private org.jdesktop.beansbinding.BindingGroup bindingGroup;
    // End of variables declaration//GEN-END:variables

    private boolean verificar(String nombre) {
        boolean ver = false;

        if (nombre.equals("")) {
            JOptionPane.showMessageDialog(this, "Por favor ingrese el nombre del producto!!!", "Error", JOptionPane.ERROR_MESSAGE);
        } else if (!validador.getInstance().soloContieneLetras(nombre)) {
            JOptionPane.showMessageDialog(this, "Nombre incorrecto: Ingrese solo letras para nombre del producto!!!", "Error", JOptionPane.ERROR_MESSAGE);
      
        } else {
            ver = true;
        }

        return ver;
    }

   


       private void limpiarDatos() {
                jTextFieldubicacion.setText("");
        jTextFieldestadolagar.setText("");
    //   jTextFieldoperario.setText("");
      jTextFielproducto.setText("");
      jTextFieldfechaalta.setText("");


    }

    private void limpiatDatos() {
/*                jTextFieldDscAgregar.setText("");
        jTextFieldClasificacionAgregar.setText("");
        jTextFieldPrecioAgregar.setText("");*/

    }

    private void limpiarDatos1() {/*
                jTextFieldNombreListar.setText("");
        jTextFielCuit.setText("");
        jTextFielapellido.setText("");*/

    }

    private void cargarComboProductos() {
        try {
            listaproductos = controladorprod.buscarTodosProducto();
           
        } catch (Exception e) {
        }
        jComboBoxProducto.removeAllItems();
        for (int i = 0; i < listaproductos.size(); i++) {
            Vector fila1 = new Vector();
            Producto p = (Producto) listaproductos.get(i);
            fila1.add(p.getNombreProducto());
            jComboBoxProducto.addItem(fila1.get(0));
        }
    
}
private void cargarComboProductos1() {
        try {
            listaproductos = controladorprod.buscarTodosProducto();

        } catch (Exception e) {
        }
        jComboBoxProducto1.removeAllItems();
        for (int i = 0; i < listaproductos.size(); i++) {
            Vector fila1 = new Vector();
            Producto p = (Producto) listaproductos.get(i);
            fila1.add(p.getNombreProducto());
            jComboBoxProducto1.addItem(fila1.get(0));
        }
    }

    private void cargarComboIdentificacion() {
         try {
            lista = controladorestlag.buscarTodosEstadolagar();

        } catch (Exception e) {
        }
        jComboBoxIdentificacion.removeAllItems();
        for (int i = 0; i < lista.size(); i++) {
            Vector fila1 = new Vector();
            Estadolagar e = (Estadolagar) lista.get(i);
            fila1.add(e.getIdentificacion());
            jComboBoxIdentificacion.addItem(fila1.get(0));
        }

    }

    private void limpiarcampos() {
         jComboBoxUbicacion1.setSelectedItem(null);

    //   jTextFieldOperario1.setText("");
     jComboBoxestado1.setSelectedItem(null);
     jDateChooserSelectorFecha1.setDate(null);
      jTextFieldidentificacion.setText("");
      jComboBoxProducto1.setSelectedItem(null);
      jTextFieldOperario1.setText(null);

    }

private void limpiarcampos1() {
         jComboBoxUbicacion.setSelectedItem(null);

     //  jTextFieldOperario.setText("");
     jComboBoxEstado.setSelectedItem(null);
     jDateChooserSelectorFecha.setDate(null);
      jTextFieldIdentificacion.setText("");
      jComboBoxProducto.setSelectedItem(null);

    }

}
